from flask import request, session
from glb import app
from glb import parse_params_raw, parse_params
import login, battle_mgr
import mainui, playerui


#
# login
#
@app.route('/login', methods=['GET', 'POST'])
def login_login():
	return login.on_login(parse_params_raw(request))

@app.route('/login_ca', methods=['GET', 'POST'])
def login_create_account():
	return login.on_create_account(parse_params_raw(request))

@app.route('/login_cr', methods=['GET', 'POST'])
def login_create_role():
	return apply(login.on_create_role, parse_params(request))

#
# mainui
#
@app.route('/get_main_data', methods=['GET', 'POST'])
def get_main_data():
	return apply(mainui.on_get_main_data, parse_params(request))

@app.route('/get_self_info', methods=['GET', 'POST'])
def get_self_info():
	return apply(mainui.on_get_self_info, parse_params(request))


# game work ..
@app.route('/start_event', methods=['GET', 'POST'])
def start_event():
	return apply(mainui.start_event, parse_params(request))

@app.route('/stop_event', methods=['GET', 'POST'])
def stop_event():
	return apply(mainui.stop_event, parse_params(request))


#
# battle array
#
@app.route('/ba_get', methods=['GET', 'POST'])
def ba_get():
	return apply(mainui.on_get_battlearray, parse_params(request))

@app.route('/ba_change', methods=['GET', 'POST'])
def ba_change():
	return apply(mainui.on_battlearray_change, parse_params(request))


#
# mission
#
@app.route('/get_mission_data', methods=['GET', 'POST'])
def get_mission_data():
	return apply(mainui.on_get_mission_data, parse_params(request))

@app.route('/complete_mission', methods=['GET', 'POST'])
def complete_mission():
	return apply(storyui.on_complete_mission, parse_params(request))

#
# battle
#
@app.route('/pve', methods=['GET', 'POST'])
def pve ():
	return apply(battle_mgr.start_battle_pve, parse_params(request))

#
# skill
#
@app.route('/get_skill_data', methods=['GET', 'POST'])
def get_skill_data():
	return apply(mainui.on_get_skill_data, parse_params(request))


@app.route('/skill_level_up', methods=['GET', 'POST'])
def skill_level_up():
	return apply(mainui.on_skill_level_up, parse_params(request))

#
# card
#
@app.route('/card_level_up', methods=['GET', 'POST'])
def card_level_up():
	return apply(playerui.on_card_level_up, parse_params(request))


@app.route('/card_quality_up', methods=['GET', 'POST'])
def card_quality_up():
	return apply(playerui.on_card_quality_up, parse_params(request))


